#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by master on 2017/3/11


# SFTPClient
#
# use for connection remote server to upload and download
#
# base username  and password

import paramiko

# build connection
transport = paramiko.Transport(("hostname", 22))
transport.connect(username="username", password="password")

# create sftp client
sftp = paramiko.SFTPClient.from_transport(transport)

# upload
sftp.put("source", "destination")

# download
sftp.get("remote_path", "local_path")

# close connection
transport.close()
